package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 添加套餐中的菜品数据
     *
     * @param setmealDishes
     */

    void insertBatch(List<SetmealDish> setmealDishes);


    /**
     * 回显套餐中菜品数据
     *
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getDishBySetmealId(Long id);


    /**
     * 根据菜品id获取套餐使用菜品的数量
     *
     * @param ids
     * @return
     */
    Integer getSetmealCountByIds(List<Integer> ids);


    /**
     * 删除菜品根据套餐id
     *
     * @param id
     */
    void deleteDishById(Long id);


    /**
     * 删除套餐里面的菜品
     * @param id
     */
    @Delete("delete from setmeal_dish where id = #{id}")
    void deleteDishBySetmealId(Long id);
}
